-
Notifications
You must be signed in to change notification settings - Fork 3
ROX-31266: Implement tests with valid and invalid utf 8 strings #251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
ROX-31266: Implement tests with valid and invalid utf 8 strings #251
Conversation
Molter73
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still need to go through the rust unit tests, my first impression is that they are quite convoluted for testing some functions that are relatively simple and straightforward. The integration tests provide a lot more value because they are testing not just those functions but also the BPF programs and the rest of the userspace logic, I would focus on those.
35fbb9e to
79f1728
Compare
|
The test failures you are having should be fixed by #270, try rebasing to that, apologies for the inconvenience! |
Molter73
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have few small comments, but overall LGTM! Thanks for tackling this one!
tests/test_path_unlink.py
Outdated
| server: The server instance to communicate with. | ||
| filename: Name of the file to create and remove (includes UTF-8 test cases). | ||
| """ | ||
| test_file = join_path_with_filename(monitored_dir, filename) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency with other tests, we might want to rename this to fut
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
tests/test_path_chown.py
Outdated
| # Convert filename to string, replacing invalid UTF-8 with U+FFFD | ||
| filename_str = path_to_string(filename) | ||
|
|
||
| # File Under Test | ||
| fut = '/container-dir/test.txt' | ||
| fut = f'/container-dir/{filename_str}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be condensed a bit more.
| # Convert filename to string, replacing invalid UTF-8 with U+FFFD | |
| filename_str = path_to_string(filename) | |
| # File Under Test | |
| fut = '/container-dir/test.txt' | |
| fut = f'/container-dir/{filename_str}' | |
| # File Under Test | |
| fut = f'/container-dir/{path_to_string(filename)}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For whatever reason I was not able to add this suggestion to the batch, so I made this change manually.
…s replaced when comparing to the result
Co-authored-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
Co-authored-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
Co-authored-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
Co-authored-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
Co-authored-by: Mauro Ezequiel Moltrasio <mmoltras@redhat.com>
840df31 to
dc43848
Compare
Description
Parameterized the filename in the existing
test_openandtest_multipletests. The input file names include regular ASCII, accents, Cyrillic, Chinese, and emoji.Unit tests were also added for
slice_to_string,sanitize_d_path, and creation of processes with valid ASCII, Cyrillic, Chinese, Japanese, Arabic, emoji, and invalid UTF-8.Checklist
Automated testing
If any of these don't apply, please comment below.
Testing Performed
CI is sufficient